package com.trend.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.trend.config.IpConfiguration;
import com.trend.pojo.Index;
import com.trend.service.IndexService;

// 返回代码集合
@RestController
public class IndexController {
	
	@Autowired IndexService indexService;
	@Autowired IpConfiguration ipConfiguration;
	
	@GetMapping("codes")
	@CrossOrigin // 允许跨域
	public List<Index> codes() throws Exception{
		System.out.println("current instance's port is" + ipConfiguration.getPort());
		return indexService.get();
	}

}
